export interface MinerCount {
  normal_count: number;
  warning_count: number;
  abnormal_count: number;
  downtime_count: number;
  online_count: number;
  offline_count: number;
}

export default function formatMinerCount(
  miner: string,
  miner_num: number,
): MinerCount {
  // 0|1|1|0|220|0
  const minerCountArr = miner.split('|');
  return {
    normal_count: parseInt(minerCountArr[0]),
    warning_count: parseInt(minerCountArr[1]),
    abnormal_count: parseInt(minerCountArr[2]),
    downtime_count: parseInt(minerCountArr[3]),
    online_count: miner_num - parseInt(minerCountArr[4]),
    offline_count: parseInt(minerCountArr[4]),
  };
}
